package com.tvsinfo.jdk.demo.case2_function_interface.dto;

import java.io.Serializable;
import java.util.List;

public class Car implements Serializable {
    private int id;
    private String brand;
    /**
     * 价格
     */
    private Integer price;
    /**
     * 颜色
     */
    private String color;
    /**
     * 长度
     */
    private Integer length;

    /**
     * 经销商
     */
    private List<String> agency;


    public Car() {
    }

    public Car(int id, String brand, Integer price, String color, Integer length, List<String> agency) {
        this.id = id;
        this.brand = brand;
        this.price = price;
        this.color = color;
        this.length = length;
        this.agency = agency;
    }

    public Car(String brand, Integer price, String color, Integer length) {
        this.brand = brand;
        this.price = price;
        this.color = color;
        this.length = length;
    }


    public Car(String brand, Integer price, String color, Integer length, List<String> agency) {
        this.brand = brand;
        this.price = price;
        this.color = color;
        this.length = length;
        this.agency = agency;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getLength() {
        try {
            Thread.sleep(200L);
            System.out.println(Thread.currentThread().getId() + ":" + Thread.currentThread().getName() + " value:" + length);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public List<String> getAgency() {
        return agency;
    }

    public void setAgency(List<String> agency) {
        this.agency = agency;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "\n\r" + "{" + "brand='" + brand + ", price=" + price + ", color='" + color + ", length=" + length + '}';
    }
}
